<template>
	<view>
		<u-navbar :title="$t('home.notice_details')" placeholder bgColor="#12be98" leftIconColor="#FFFFFF"
			titleStyle="color: #FFFFFF" autoBack>
		</u-navbar>
		<view class="content">
			<view class="font-32">{{noticeInfo.title}}</view>
			<!-- <text class="font-22 color_929292">{{formatTimestamp(noticeInfo.created_at * 1000)}}</text> -->

			<view class="mar-top-30">
				<rich-text :nodes="noticeInfo.content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		noticeDetail
	} from '@/api/index'
	import {
		formatTimestamp
	} from '@/util/commonFunction'

	const noticeId = ref('')
	const noticeInfo = ref({})
	const getNoticeDetail = async () => {
		const res = await noticeDetail({
			id: noticeId.value
		})
		noticeInfo.value = res.data
	}

	onLoad((options) => {
		noticeId.value = options.id
		if (noticeId.value) getNoticeDetail()
	})
</script>

<style lang="scss" scoped>
	.content {
		padding: 20rpx 35rpx;
		box-sizing: border-box;
	}
</style>